Engine

public interface Engine implements Closeable, Observable<T>

Provides access to the Chromium engine functionality.

To perform operations with the engine, a license key is required. The license key represents a string that can be set via the "jxbrowser.license.key" system property or individually for every Engine using the licenseKey method. If you set the license key via the system property, then please make sure that you set it before creating an Engine instance.

The Chromium engine is running in a separate native process. Communication between the native and Java process is done through the Inter-Process Communication (IPC) layer that allows transferring data between two processes on a local machine.

The native process allocates memory and system resources that must be released. So, when the engine is no longer needed, it must be closed through the close method to shutdown the native process and free all the allocated memory and system resources. For example:

Engine engine = Engine.newInstance(engineOptions);
...
engine.close();

Any attempt to use an already closed engine will lead to the IllegalStateException.

To get notifications that the Engine instance has been closed subscribe to the following event:


engine.on(EngineClosed.class, event -> {
    // The engine has been closed.
});
To get notifications that the Engine instance has been unexpectedly terminated use:

engine.on(EngineCrashed.class, event -> {
    // The engine has been unexpectedly terminated.
});

Properties

Link copied to clipboard
public final CookieStore cookieStore
public final CookieStore cookieStore

A store that allows managing cookies.

Link copied to clipboard
public final Downloads downloads
public final Downloads downloads

A service that allows managing downloads.

Link copied to clipboard

A service for working with HTTP authentication cache.

Link copied to clipboard
public final HttpCache httpCache
public final HttpCache httpCache

A service for working with HTTP cache.

Link copied to clipboard

Returns a license that was used to create this Engine.

Link copied to clipboard

A service that allows managing media stream devices.

Link copied to clipboard
public final Network network
public final Network network

A service that allows working with network.

Link copied to clipboard
public final EngineOptions options
public final EngineOptions options

Returns options of this Engine.

Link copied to clipboard
public final Permissions permissions
public final Permissions permissions

A service that allows managing permissions.

Link copied to clipboard
public final Plugins plugins
public final Plugins plugins

A service that allows configuring plugins.

Link copied to clipboard
public final Profiles profiles
public final Profiles profiles

A service for managing profiles.

Link copied to clipboard
public final Proxy proxy
public final Proxy proxy

A service that allows working with proxy.

Link copied to clipboard

A service that allows working with spell checking functionality.

Link copied to clipboard
public final ZoomLevels zoomLevels
public final ZoomLevels zoomLevels

A service that allows working with zoom.

Functions

Link copied to clipboard
public abstract List<Browser> browsers()
Returns an immutable list of alive Browser instances including child popup browsers for the default profile.
Link copied to clipboard
public abstract void close()
Closes this object and releases all resources associated with it.
public abstract void close()
Link copied to clipboard
public abstract CookieStore cookieStore()
Returns the cookie store that allows managing cookies.
Link copied to clipboard
public abstract Downloads downloads()
Returns a service that allows managing downloads.
Link copied to clipboard
public abstract HttpAuthCache httpAuthCache()
Returns a service for working with HTTP authentication cache.
Link copied to clipboard
public abstract HttpCache httpCache()
Returns a service for working with HTTP cache.
Link copied to clipboard
public abstract boolean isClosed()
Returns true if the current object is closed.
Link copied to clipboard
public abstract MediaDevices mediaDevices()
Returns a service that allows managing media stream devices.
Link copied to clipboard
public abstract Network network()
Returns a service that allows working with network.
Link copied to clipboard
public abstract Browser newBrowser()
Creates a new Browser instance under the default profile and navigates it to the "about:blank" web page within the defaultTimeout.
Link copied to clipboard
public static Engine newInstance(EngineOptions options)
Initializes and runs the Chromium engine with the given options.
public static Engine newInstance(RenderingMode renderingMode)
Initializes and runs the Chromium engine in the given renderingMode.
Link copied to clipboard
public abstract Subscription on<E extends T>(Class<E> eventClass, Observer<E> observer)
Subscribes the given event observer to receive the events of the given eventClass.
Link copied to clipboard
public abstract EngineOptions options()
Returns the options the current engine was initialized with.
Link copied to clipboard
public abstract Permissions permissions()
Returns a service that allows managing permissions.
Link copied to clipboard
public abstract Plugins plugins()
Returns a service that allows configuring plugins.
Link copied to clipboard
public abstract Profiles profiles()
Returns a service for managing profiles.
Link copied to clipboard
public abstract Proxy proxy()
Returns a service that allows working with proxy.
Link copied to clipboard
public abstract void setTheme(Theme theme)
Updates the Chromium theme.
Link copied to clipboard
public abstract SpellChecker spellChecker()
Returns a service that allows working with spell checking functionality.
Link copied to clipboard
public final Subscription subscribe<E extends Event>(Observer<E> observer)
public final Subscription subscribe<E extends Event>(Observer<E> observer)

Subscribes the given observer to receive events of type E from this Observable.

Link copied to clipboard
public abstract Theme theme()
Returns the current Chromium theme.
Link copied to clipboard
public abstract ZoomLevels zoomLevels()
Returns a service that allows working with zoom.